home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / os2 / wsec204e.zip / CIDINST.CMD < prev    next >
OS/2 REXX Batch file  |  1995-11-27  |  6KB  |  152 lines

  1. /******************************************************************/
  2. /* CIDINST.CMD Workplace Security CID utility                     */
  3. /*                                                                */
  4. /*                                                                */
  5. /*  Function:  Automates Workplace Security Installation          */
  6. /*                                                                */
  7. /*                                                                */
  8. /*  Command format: CIDINST action regcode password               */
  9. /*                                                                */
  10. /*  Command line options:                                         */
  11. /*                                                                */
  12. /*   action   = INSTALL,DELETE,UPDATE, or RESTORE (one required)  */
  13. /*                                                                */
  14. /*   regcode  = product registration code (INSTALL only)          */
  15. /*                                                                */
  16. /*   password = Master password of your choice (INSTALL only)     */
  17. /*                                                                */
  18. /*                                                                */
  19. /*  Example:  CIDINST INSTALL ABC123DEF456 MASTER                 */
  20. /*                                                                */
  21. /*  Note: Change the Source_directory and Target_directory        */
  22. /*  ----  as appropriate for your installation.                   */
  23. /*                                                                */
  24.           Source_directory  = "C:\TEMP"
  25.           Target_directory  = "C:\WPSECURE"
  26. /*                                                                */
  27. /*                                                                */
  28. /*  All output message are written to the CIDINST.LOG file        */
  29. /*  which is created in the Target_Directory. Check this log      */
  30. /*  to verify that the install action has completed successfully. */
  31. /*                                                                */
  32. /* Workplace Security Copyright (C) 1995 by Maple Valley Software */
  33. /******************************************************************/
  34.  
  35.  
  36. '@Echo Off'
  37. /* Load REXXUTIL */
  38.  
  39. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  40. Call SysLoadFuncs
  41.  
  42. /* Initialize */
  43. irc = 0
  44. log_date = insert('-',date('S'),6)
  45. log_date = insert('-',log_date,4)
  46. log_time = substr(time('L'),1,11)   
  47.  
  48. Signal On Failure Name FAILURE
  49. Signal On Halt Name HALT
  50. Signal On Syntax Name SYNTAX
  51.  
  52. parse upper arg install_action regcode password .
  53.  
  54.  
  55. Call SysCls
  56.  
  57. if wordpos(install_action,"INSTALL UPDATE RESTORE DELETE") = 0 then do
  58.      say 'CIDINST action not specified.'
  59.      exit 65280
  60.      end
  61.  
  62. if install_action = "INSTALL" then do
  63.      if regcode = '' then do 
  64.      say 'CIDINST INSTALL requires the registration code and master password.'
  65.      exit 65280
  66.      end
  67.  
  68.      if password = '' then do 
  69.      say 'CIDINST INSTALL requires the registration code and master password.'
  70.      exit 65280
  71.      end
  72.    end
  73.  
  74. /* Build CID install options */
  75. Product_name        = '/P:"Workplace Security"'
  76. Install_Catalog     = "/C:"||Source_directory||"\WPSECURE.ICF"
  77. Install_log         = Target_directory||"\CIDINST.LOG"
  78. Response_file       = Target_directory||"\WPSECURE.RSP"
  79.  
  80. /* Create Target Directory */
  81. Result = SysFileTree( Target_directory, 'Dirs', 'D' )
  82. If Dirs.0 = 0 Then
  83.   Do
  84.   Result = SysMkDir( Target_directory )
  85.   if Result == 0 Then
  86.     Do
  87.     End
  88.   Else
  89.     Do
  90.     Say 'ERROR: Unable to create target directory.'
  91.     Signal DONE
  92.     End
  93.   End
  94.  
  95.  
  96. /* build Response file */
  97.  
  98. call lineout Response_file,,1           /* open the file */ 
  99. call lineout Response_file,"FILE         = "Target_directory 
  100. call lineout Response_file,"WORK         = "Target_directory 
  101. call lineout Response_file,"COMP         = Workplace Security"
  102. call lineout Response_file,"CFGUPDATE    = MANUAL" 
  103. call lineout Response_file,"OVERWRITE    = YES"
  104. call lineout Response_file,"SAVEBACKUP   = YES"
  105. call lineout Response_file,"DELETEBACKUP = NO"
  106. call lineout Response_file              /* close the file */
  107.  
  108. Install_action = translate(install_action)
  109. if install_action = "INSTALL" then Action = "/A:I"
  110. if install_action = "DELETE"  then Action = "/A:D"
  111. if install_action = "UPDATE"  then Action = "/A:U"
  112. if install_action = "RESTORE" then Action = "/A:R"
  113.  
  114. CID_Install_Options = Action "/X /O:DRIVE /S:"||Source_directory " /T:"||Target_directory "/R:"||Response_file "/L1:"||Install_log   
  115.  
  116. call directory(Source_directory)
  117.  
  118. "INSTALL.EXE" Product_name CID_Install_Options Install_Catalog   
  119. irc = rc    /* save return code from installer */
  120.  
  121. call directory(Target_directory)
  122.  
  123. if install_action = "INSTALL" then do
  124.    'REGISTER.EXE' regcode password
  125.    rrc = rc 
  126.    log_time = substr(time('L'),1,11)   
  127.    if rrc = 0 then call lineout Install_log, log_date log_time ' Workplace Security Registration complete'
  128.    if rrc = 1 then call lineout Install_log, log_date log_time ' ERROR: Invalid registration code'
  129.    if rrc = 2 then call lineout Install_log, log_date log_time ' ERROR: REGISTER parameters missing' 
  130.    if rrc <> 0 then irc = 65280 
  131.    end
  132.  
  133. Signal DONE 
  134.  
  135. FAILURE:
  136. call lineout Install_log, log_date log_time ' REXX failure: Error in CIDINST.CMD'
  137. irc = 65042
  138. Signal DONE
  139.  
  140. HALT:
  141. call lineout Install_log, log_date log_time ' REXX halt: Error in CIDINST.CMD'
  142. irc = 65042
  143. Signal DONE
  144.  
  145. SYNTAX:
  146. call lineout Install_log, log_date log_time ' REXX syntax error: Error in CIDINST.CMD'
  147. irc = 65042
  148. Signal DONE
  149.  
  150. DONE:
  151. Exit irc
  152.